//
//  HPCustomerListCell.m
//  HappyPenguin
//
//  Created by zhuangyihang on 1/8/16.
//  Copyright © 2016 zhuangyihang. All rights reserved.
//

#import "HPCustomerListCell.h"
#import "UIImage+Common.h"
#import "UIConstants.h"

static const NSInteger kPortraitWidth = 35;
static const NSInteger kPortraitMarginLeft = 10;

@implementation HPCustomerListCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        NSMutableArray *rightUtilityButtons = [NSMutableArray new];
        
        [rightUtilityButtons sw_addUtilityButtonWithColor:[UIColor colorWithRGB:0x058cc0]
                                                    icon:[UIImage imageNamed:@"Button_AddTask"]];
        [rightUtilityButtons sw_addUtilityButtonWithColor:[UIColor colorWithRGB:0x066c95]
                                                    icon:[UIImage imageNamed:@"Button_AddTask"]];
        
        self.rightUtilityButtons = rightUtilityButtons;
        
        self.portraitImageView = [UIImageView new];
        [self.contentView addSubview:self.portraitImageView];
        [self.portraitImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.height.mas_equalTo(kPortraitWidth);
            make.centerY.equalTo(self.contentView);
            make.left.mas_equalTo(kPortraitMarginLeft);
        }];
        self.portraitImageView.layer.cornerRadius = kPortraitWidth/2;
        self.portraitImageView.clipsToBounds = YES;
        self.portraitImageView.contentMode = UIViewContentModeScaleAspectFill;
        
        //使cell上的标题和分割线都往右边移动
        self.imageView.image = [UIImage imageWithColor:[UIColor clearColor] withFrame:CGRectMake(0, 0, 30, 30)];
        
        self.textLabel.font = [UIConstants getFont:16];
        self.detailTextLabel.font = [UIConstants getFont:13];
        
        self.textLabel.textColor = [UIColor colorWithRGB:0x505050];
        self.detailTextLabel.textColor = [UIColor colorWithRGB:0x606060];
    }
    return self;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

+ (CGFloat)getCellHeight{
    return 50;
}
@end
